#include <stdio.h>
#include <stdlib.h>

int main (int argc, char const* argv[])
{
    int i, c, t, n, sum, max, first, last, temp;
    int a[100000];

    scanf("%d", &t);

    c = 1;
    while (c <= t) {
        scanf("%d", &n);

        for (i = 0; i < n; i++) {
            scanf("%d", &a[i]);
        }

        sum = 0; max = -1001;
        first = 0; last = 0; temp = 1;
        for (i = 0; i < n; i++) {
            sum += a[i];

            if (sum > max) {
                max = sum;
                first = temp;
                last = i + 1;
            }

            if (sum < 0) {
                sum = 0;
                temp = i + 2;
            }
        }

        printf("Case %d:\n", c);
        printf("%d %d %d\n", max, first, last);
        if (c != t) printf("\n");

        c++;
    }

    return 0;
}
